﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using System.Windows;

namespace ZoneLine.Views.converts
{
    public class EqualsParameterVisibilityConverter : IValueConverter
    {
        // 转换方法：使用 parameter 与传入值进行比较
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value == null || parameter == null)
                return Visibility.Collapsed;

            // 比较传入的值与 parameter 是否相等
            //return value.Equals(parameter) ? Visibility.Visible : Visibility.Collapsed;
            return Visibility.Visible;
        }

        // ConvertBack 方法：一般情况下不用实现，因为通常 Visibility 不需要反向转换
        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            return Binding.DoNothing;
        }
    }
}
